/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ejercicios;

/**
 *
 * @author zpiik3
 */
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;


public class rimas {


    public static void main(String[] args)  {

        try {
        File f = new File("rima.txt");
        FileReader f1 = new FileReader(f);
       BufferedReader br = new BufferedReader(f1);
       String linea1=br.readLine();
       String linea2=br.readLine();
       String linea3=br.readLine();
       String linea4=br.readLine();
            System.out.println(linea1);
            System.out.println(linea2);
            System.out.println(linea3);
            System.out.println(linea4);
            if(linea1.endsWith(linea3.substring(linea3.length()-3, linea3.length()))&&linea2.endsWith(linea4.substring(linea4.length()-3, linea4.length()))){
                System.out.println("Si riman");
            }
            else{
                System.out.println("No riman");
            }
        } catch (Exception ex) {
            System.out.println(ex);
        }

    }
}